#ifndef GAMEENGINE_AI_PATH_FINDING_ASTAR_NODE_HPP
#define GAMEENGINE_AI_PATH_FINDING_ASTAR_NODE_HPP


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

//! Default constructor
template <class Graph>
AStarNode<Graph>::AStarNode() {}

//! Constructor
/*!
 @param node The node associated to the A-star search
 @param parent The parent of the node associated to the A-star search
 @param cost The total cost spent so far to reach the node
 @note Classes Graph::Node and Graph::Cost should have a copy constructor
 */
template <class Graph>
AStarNode<Graph>::AStarNode(typename Graph::Node node, typename Graph::Node parent, typename Graph::Cost cost) :
	node_(node), parent_(parent), cost_(cost) {}

//! Copy constructor
/*!
 @param rhs The A-star node to copy
 @note Classes Graph::Node and Graph::Cost should have a copy constructor
 */
template <class Graph>
AStarNode<Graph>::AStarNode(const AStarNode& rhs) : node_(rhs.node_), parent_(rhs.parent_), cost_(rhs.cost_) {}

//! Assignment operator
/*!
 @param rhs The A-star node to copy
 @note Classes Graph::Node and Graph::Cost should have an assignment operator
 */
template <class Graph>
AStarNode<Graph>& AStarNode<Graph>::operator=(const AStarNode& rhs) {
	if ( &rhs != this ) {
		node_ = rhs.node_;
		parent_ = rhs.parent_;
		cost_ = rhs.cost_;
	}
	return *this;
}

//! Destructor
template <class Graph>
AStarNode<Graph>::~AStarNode() {}

//! Accessor to the node associated to the A-star search (read only)
/*!
 @return The node associated to the A-star search
 */
template <class Graph>
typename Graph::Node AStarNode<Graph>::node() const {
	return node_;
}

//! Accessor to the node associated to the A-star search (read-write)
/*!
 @return A reference to the node associated to the A-star search
 */
template <class Graph>
typename Graph::Node& AStarNode<Graph>::node() {
	return node_;
}

//! Accessor to the parent of the node associated to the A-star search (read only)
/*!
 @return The parent of the node associated to the A-star search
 */
template <class Graph>
typename Graph::Node AStarNode<Graph>::parent() const {
	return parent_;
}

//! Accessor to the parent of the node associated to the A-star search (read-write)
/*!
 @return A reference to the parent of the node associated to the A-star search
 */
template <class Graph>
typename Graph::Node& AStarNode<Graph>::parent() {
	return parent_;
}

//! Accessor to the total cost spent so far to reach the node (read only)
/*!
 @return The total cost spent so far to reach the node
 */
template <class Graph>
typename Graph::Cost AStarNode<Graph>::cost() const {
	return cost_;
}

//! Accessor to the total cost spent so far to reach the node (read-write)
/*!
 @return A reference to the total cost spent so far to reach the node
 */
template <class Graph>
typename Graph::Cost& AStarNode<Graph>::cost() {
	return cost_;
}

//! Comparison operator
/*!
 @param rhs The Astar node to compare
 @return True if the current node is inferior to the other node, false otherwise
 */
template <class Graph>
bool AStarNode<Graph>::operator<(const AStarNode& rhs) const {
	return node_ < rhs.node_;
}


#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
